package game.ball;

import game.players.SoccerPlayer;

import com.uqbar.vainilla.DeltaState;

public class Possessed extends SoccerBallState {
	
	SoccerPlayer player;

	public Possessed(SoccerPlayer player) {
		this.setBall(player.getScene().getSoccerBall());
		this.player = player;
		player.getScene().getSoccerBall().setLastTouched(player);
	}
	
	public Possessed(SoccerPlayer player,SoccerBall ball){
		this.setBall(ball);
		this.player = player;
		ball.setLastTouched(player);
	}
	
	@Override
	public void update(DeltaState deltaState) {
		// La mueve el jugador
	}
	
	@Override
	protected void moveUpDownWithCentralizedCamera(double x, double y) {
		this.getBall().move(0, y);
		this.getPlayer().move(0, y);
		this.getBall().getScene().moveSprites(x, 0);
	}
	
	@Override
	protected void moveRightLeftWithCentralizedCamera(double x, double y) {
		this.getBall().move(x, 0);
		this.getPlayer().move(x, 0);
		this.getBall().getScene().moveSprites(0, y);
	}
	
	@Override
	protected void advance(double x, double y) {
		this.getBall().move(x, y);
		this.getPlayer().move(x, y);
	}

	
	
	
	
	public SoccerPlayer getPlayer() {
		return player;
	}

	@Override
	public boolean isFree() {
		return false;
	}
}
